﻿using System;
using System.Text;
using System.Windows.Forms;
using Notepad_X;
using Notepad_X.Plugin;

namespace FileExplorerSidebarPlugin
{
    public class plugin :IPlugin
    {
        Explorer PluginContainer;

        SideBarPlugin.plugin Sidebar=null;
        
        public string Name
        {get { return "File Explorer Sidebar Plugin"; }}
        public string Author
        {get { return "NohponeX"; }}
        public string Description
        {get { return "Notepad X Sidebar Plugin\n\r File Explorer Plugin \n\r Requires Notepad X 2.2 or newer"; }}
        public string Version
        {get { return "1.2"; }}

        public bool HasSettings {
            get { return false; }
        }

        public void Initialize()
        {
            try
            {
                Sidebar = SideBarPlugin.Functions.GetSidebarPlugin();
                if (Sidebar != null)
                {
                    if (!Sidebar.Controls.ContainsKey("File Explorer"))
                    {
                        PluginContainer = new Explorer();
                        PluginContainer.Text = "File Explorer";
                        PluginContainer.Name = "File Explorer";
                        PluginContainer.Dock = DockStyle.Fill;
                        Sidebar.AddSidebarPlugin(PluginContainer);
                    }
                }
            }
            catch { }
        }
        public void Dispose()
        {
            try
            {
                Sidebar = SideBarPlugin.Functions.GetSidebarPlugin();
                if (Sidebar != null && PluginContainer!= null)
                {
                    if (Sidebar.Controls.ContainsKey(PluginContainer.Name))
                    {
                        Sidebar.RemoveSidebarPlugin(PluginContainer);
                    }
                }
            }
            catch { }
        }
        public void Settings() { }
    }
}
